﻿@model ShiXuLong.Model.ShopType
    @{
        Layout = null;
    }

    <!DOCTYPE html>

    <html>
    <head>
        <meta name="viewport" content="width=device-width" />
        <title>ProductTypeAdd</title>
        <script src="~/Scripts/jquery-3.5.1.js"></script>
        <link href="~/Scripts/layui/css/layui.css" rel="stylesheet" />
        <script src="~/Scripts/layui/layui.js"></script>
        <script src="~/Scripts/jquery.validate.unobtrusive.js"></script>
        <script src="~/Scripts/jquery.unobtrusive-ajax.js"></script>
        <script src="~/Scripts/jquery.validate.js"></script>
    </head>
    <body>
        <div>
            @using (Ajax.BeginForm("ProductTypeAdd", "Shop", new AjaxOptions { OnSuccess = "addComp" }))
            {
                @Html.HiddenFor(m => m.Id)
               
                <div class="layui-form-item">
                    @Html.Label("商品名称")
                    @Html.EditorFor(m => m.ShopTypeName)
                    @Html.ValidationMessageFor(m => m.ShopTypeName)
                </div>
                <div class="layui-form-item">
                    @Html.Label("父级编号")
                    @Html.EditorFor(m => m.ParentId)
                    @Html.ValidationMessageFor(m => m.ParentId)
                </div>
                <div class="layui-form-item">
                    @Html.Label("权重")
                    @Html.EditorFor(m => m.Weight)
                    @Html.ValidationMessageFor(m => m.Weight)
                </div>
                <button>提交</button>
            }
            <script>
                function addComp(re) {
                    if (re.success) {
                        parent.layer.msg(re.msg);
                        parent.layui.$("#btnSearch").click();
                        var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                        parent.layer.close(index); //再执行关闭
                    } else {
                        alert(re.msg);
                    }
                }
            </script>
        </div>

    </body>
</html>
